// webpack配置覆盖cli3模块中webpack默认配置

// 1.对路径进行简名操作
const path = require('path');

function join(url) {
    return path.join(__dirname, url)
}
module.exports = {
    // chainWebpack: callback(config ){...}
    chainWebpack: config => {
        // config.resolve.alias.set(路径简名，文件路径).set() ... 链式调用
        config.resolve.alias
            .set('styles', join('./src/assets/styles'))
            .set('pages', join('./src/pages'))
            .set('utils', join('./src/utils'))
            .set('components', join('./src/components'))
            .set('layout', join('./src/components/layout'))
            .set('common', join('./src/components/common'))
    },

    // baseUrl: '/dist/',

    devServer: {
        proxy: {
            '/mcp': {
                target: 'https://openapi.vmall.com',
                changeOrigin: true,
            },
            '/product': {
                target: 'https://m.vmall.com',
                changeOrigin: true,
            },
        }
    }
}